import { defineStore } from 'pinia'

/**
 * 主应用状态管理
 */
export const useAppStore = defineStore('app', {
  state: () => ({
    title: 'AI博客系统',
    loading: false
  }),
  
  getters: {
    getTitle: (state) => state.title,
    isLoading: (state) => state.loading
  },
  
  actions: {
    /**
     * 设置加载状态
     * @param {boolean} loading - 加载状态
     */
    setLoading(loading) {
      this.loading = loading
    },
    
    /**
     * 设置标题
     * @param {string} title - 页面标题
     */
    setTitle(title) {
      this.title = title
    }
  }
})